package cn.shengchao.service;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjUtil;
import cn.shengchao.examstar.product.acl.adapters.repositories.ProductRepository;
import cn.shengchao.examstar.product.domain.entity.CourseKnowledgeNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: examstarapi
 * @description: 联系客户画像课程统计
 * @author: Xiong weiqiang
 * @create: 2025-04-19 16:26
 */
@Service
public class ContactUserAppService {

    @Autowired
    private ProductRepository productRepository;

    public void ssd() {
        List<CourseKnowledgeNode> courseKnowledgeNodes = productRepository.findListByCourseId(1L, "", true);
        //总时长
        long durationTotal = 0L;
        if (CollUtil.isNotEmpty(courseKnowledgeNodes)) {
            for (CourseKnowledgeNode courseKnowledgeNode : courseKnowledgeNodes) {
                durationTotal = durationTotal + ObjUtil.defaultIfNull(courseKnowledgeNode.getDuration(), 0L).longValue();
            }
        }

    }
}